package com.demo2;

import java.util.Scanner;

public class StringBuilderDemo5 {
    public static void main(String[] args) {
        //使用stringBuilder的场景:
        //1.字符串的拼接
        //2.字符串的反转


        //1.录入一个字符串
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入一个字符串:");
        String str = scanner.next();
        //2.反转字符串
        StringBuilder builder = new StringBuilder();
        String result = builder.append(str).reverse().toString();
        //3.比较
        if(str.equals(result)){
            System.out.println("字符串是对称的！！");
        }else {
            System.out.println("字符串不是对称的！！");
        }
    }
}
